<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      function makeCounter() {
        let count = 0;
        function Counter() {
          return count++;
        }
        Counter.set = function (value) {
          count = value;
        };
        Counter.decrease = function () {
          count--;
        };
        return Counter; // {}
      }
      const counter = makeCounter();
      console.log(counter());
      console.log(counter());
      console.log(counter());
      counter.set(100);
      console.log(counter());
      console.log(counter());
      console.log(counter());
      counter.decrease();
      counter.decrease();
      counter.decrease();
      counter.decrease();
      counter.decrease();
      console.log(counter());
    </script>
  </body>
</html>
